package com.fastCms.business.bim.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fastCms.business.frame.constant.CommonConst;
import com.fastCms.business.bim.pojo.entity.Area;
import com.fastCms.business.bim.daos.AreaMapper;
import com.fastCms.business.bim.service.AreaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 区域管理 服务实现类
 * </p>
 *
 * @author liusq
 * @since 2021-04-05
 */
@Service
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements AreaService {

    @Override
    public Area findById(Integer areaId) {
        QueryWrapper<Area> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("state", CommonConst.STATE.VALID);
        queryWrapper.eq("id", areaId);
        return getOne(queryWrapper);
    }

    @Override
    public List<Area> findValidAll() {
        QueryWrapper<Area> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("state", CommonConst.STATE.VALID);
        return list(queryWrapper);
    }
}
